<?php
$this->activemenu = 30;
$this->pageTitle=Yii::app()->name . ' - Tracking';

?>
<?php $this->beginWidget('system.web.widgets.CClipWidget', array('id'=>'menu-left'));?>
<ul>
<?php 
$childPages = FrontendPagesModel::model()->findAll("parent=91");
foreach ($childPages as $key => $item):
	$link = Yii::app()->controller->createUrlPage($item->id);
	$active = ($_SERVER['REQUEST_URI']==$link)?"class='active'":"";
?>
	<li <?php echo $active;?>><a href="<?php echo $link;?>"><?php echo $item->title;?></a></li>
<?php endforeach;?>
</ul>
<?php $this->endWidget();?>
<div class="detail-page">
<div class="text">
	<p class="content-title">Tracking</p>
<div class="content-box">
<form name="trackingform" action="<?php echo Yii::app()->createUrl('/default/tracking');?>" method="get" onsubmit="return validateForm()">
	<table>
		<tbody>
		<tr>
		<td><input type="text" name="code" id="code" value="<?php echo isset($_GET['code'])?$_GET['code']:'';?>" style="width: 154px;height: 18px;">
		</td>
		<td valign="bottom"><input name="submit" type="submit" id="Submit" value="Track"></td>
		</tr>
		</tbody>
	</table>
</form>
<?php 
if($AM==1):
	if($tracks):
		?>
		
		<fieldset><legend><h3>Bill Info</h3></legend>
		<div>Customer Name: <?php echo $tracks->customer_name;?></div>
		<div>Address Customer: <?php echo $tracks->customer_address;?></div>
		<div>Customer Code: <?php echo $tracks->am_bill;?></div>
		</fieldset>
		<?php 
	else:
		echo 'Ticket Code not available. Try again';
	endif;
elseif($AM==2):
	echo !empty($tracks)?$tracks:'Ticket Code not available. Try again';
elseif($AM==3):
endif;
?>
</div>
</div>
<script>
function validateForm()
{
	var code = document.getElementById('code').value;
	if(code=='') {
		alert('Bill code not empty!');
		return false;
		}
	return true;
}
</script>